package com.jsb.laundry.dao.shops;

import com.jsb.laundry.common.response.WebResponse;
import com.jsb.laundry.model.factory.JsbOrders;
import com.jsb.laundry.model.factory.JsbOrdersFulfillment;
import com.jsb.laundry.model.factory.JsbOrdersItem;
import com.jsb.laundry.model.shops.*;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface LaundryShopsDao {

    /**
     * 获取商户信息 (登录)
     * @param merchantsInfo
     * @return
     */
    MerchantsInfo getMerchantsInfo(MerchantsInfo merchantsInfo);

    /**
     * 获取店铺信息 (授权)
     * @param merchantsInfo
     * @return
     */
    Shops getShopsInfo(MerchantsInfo merchantsInfo);

    /**
     * 获取订单列表
     * @param shopOrder
     * @return
     */
    List<ShopOrderVo> getShopsOrderList(ShopOrderVo shopOrder);

    /**
     * 订单详情
     * @return
     */
    ShopOrderDetailVo.OrderInfo getShopsOrderDetail1(ShopOrderVo shopOrder);
    List<ShopOrderDetailVo.TransportInfo> getShopsOrderDetail2(ShopOrderVo shopOrder);

    /**
     * 运单详情
     * @param shopOrder
     * @return
     */
    ShopTransportOrderDetailVo.OrderInfo getShopsTransportOrderDetail1(ShopOrderVo shopOrder);
    ShopTransportOrderDetailVo.UserInfo getShopsTransportOrderDetail2(ShopOrderVo shopOrder);
    ShopTransportOrderDetailVo.RiderInfo getShopsTransportOrderDetail3(ShopOrderVo shopOrder);
    ShopTransportOrderDetailVo.ProductInfo getShopsTransportOrderDetail4(ShopOrderVo shopOrder);

    /**
     * 获取店铺订单信息
     * @param shopOrder
     * @return
     */
    JsbOrdersShop getShopsOrderInfo(ShopOrderVo shopOrder);

    /**
     * 获取主订单信息
     * @param shopOrder
     * @return
     */
    JsbOrders getOrderInfo(ShopOrderVo shopOrder);
    /**
     * 子订单信息
     * @param orderShop
     * @return
     */
    List<JsbOrdersItem> getSubOrderList(JsbOrdersShop orderShop);
    List<JsbOrdersItem> getShopSubOrderList(ShopOrderVo shopOrder);
    List<JsbOrdersShopItem> getShopSubOrderList1(@Param("list") List<String> orderShop,@Param("trackingDirection") String trackingDirection);

    /**
     * 入店铺表 jsb_orders_shop
     * @param orderShop
     * @return
     */
    int addOrdersShop(JsbOrdersShop orderShop);

    /**
     * 入店铺表 jsb_orders_shop_item
     * @param orderShopItemList
     * @return
     */
    int addOrdersShopItem(@Param("list") List<JsbOrdersShopItem> orderShopItemList);

    /**
     * 物流信息
     * @param shopOrder
     * @return
     */
    JsbOrdersFulfillment getOrdersFulfillment(ShopOrderVo shopOrder);

    /**
     * 批量出库入库检查页面数据
     * @param shopOrder
     * @return
     */
    List<BatchOPShopsOrderVo.ProductInfo> batchShopsOrderPageData1(ShopOrderVo shopOrder);
    BatchOPShopsOrderVo.OPConfirm batchShopsOrderPageData2(ShopOrderVo shopOrder);

    /**
     * 批量入库出库时，看是否还有未检查的订单
     * @param shopOrder
     * @return
     */
    List<JsbOrdersShopItem> checkShopsOrderStatus(ShopOrderVo shopOrder);

    /**
     * 批量入库出库时更改状态 in_check\out_check 更新瑕疵、图片等
     * @param shopOrder
     * @return
     */
    int updShopsOrderStatus(ShopOrderVo shopOrder);

    /**
     * 更新jsb_orders_shop_item中 shop_orders_item_status(状态 1未入库 2已入库 3代取件 4 已出库)、in_at
     * tracking_direction 订单物流方向，1 取；2 送
     *
     * @param shopOrder
     * @return
     */
    int confirmShopsOrder1(ShopOrderVo shopOrder);

    /**
     * 更新jsb_orders_shop中 shop_orders_status(状态 1未入库 2已入库 3代取件 4 已出库)\in_at
     * order_direction 订单物流方向，1 取；2 送
     *
     * @param shopOrder
     * @return
     */
    int confirmShopsOrder2(ShopOrderVo shopOrder);

    /**
     * 更新jsb_orders中 station_status 小站/旗舰店状态 0未入库 1已入库 2已出库（对应司机或骑手）
     * order_direction 订单物流方向，1 取；2 送
     *
     * @param shopOrder
     * @return
     */
    int confirmShopsOrder3(ShopOrderVo shopOrder);

    /**
     * 已子订单全部入的订单id
     * @param shopOrder
     * @return
     */
    List<String> checkAllSuborderInOutShop(ShopOrderVo shopOrder);

    /**
     * 小站管理列表
     * @param shopOrder
     * @return
     */
    List<Shops> getShopsManagerList(ShopOrderVo shopOrder);

    /**
     * 小站管理详情
     * @param shopOrder
     * @return
     */
    ShopsManagerDetailVo.ShopInfo getShopsManagerDetail(ShopOrderVo shopOrder);

    /**
     * 骑手管理列表
     *
     * @param shopOrder
     * @return
     */
    List<ShopOrderVo> getRiderManagerList(ShopOrderVo shopOrder);

    /**
     * 骑手管理详情
     * @param shopOrder
     * @return
     */
    RiderManagerDetailVo.RiderInfo getRiderManagerDetail(ShopOrderVo shopOrder);

    /**
     * 客户管理列表
     * @param shopOrder
     * @return
     */
    List<ShopOrderVo> getUserManagerList(ShopOrderVo shopOrder);

    /**
     * 用户详情
     * @param shopOrder
     * @return
     */
    UserManagerDetailVo.UserInfo getUserManagerDetail(ShopOrderVo shopOrder);

    /**
     * 店铺信息
     * @param shopOrder
     * @return
     */
    ShopHomeVo.ShopInfo getShopHome1(ShopHomeVo shopOrder);

    /**
     * 代办事项
     * @param shopOrder
     * @return
     */
    ShopHomeVo.AgentMatters getShopHome2(ShopHomeVo shopOrder);

    /**
     * 经营数据
     * @param shopOrder
     * @return
     */
    ShopHomeVo.ManageData getShopHome3(ShopHomeVo shopOrder);

    /**
     * 增长趋势
     * @param shopOrder
     * @return
     */
    List<ShopHomeVo.IncreaseTrend> getShopHome4(ShopHomeVo shopOrder);

    /**
     * 一个店铺只能绑定一张卡
     * @param shopsBankCard
     * @return
     */
    ShopsBankCard getShopBankCard(ShopsBankCard shopsBankCard);

    /**
     * 添加店铺银行卡信息
     * @param shopsBankCard
     * @return
     */
    Integer addShopBankCard(ShopsBankCard shopsBankCard);

    /**
     * 实名认证后更新银行卡信息
     *
     * @param id
     * @param authStatus
     * @param resultMsg
     * @return
     */
    int updShopBankCardAuthStatus(@Param("id") Integer id,@Param("authStatus") String authStatus, @Param("resultMsg") String resultMsg);

    /**
     * 资金管理首页头部
     * @param shopsBankCard
     * @return
     */
    FundManageHomeVo fundManageHome1(ShopsBankCard shopsBankCard);

    /**
     * 提现记录
     * @param shopsBankCard
     * @return
     */
    List<Withdrawals> fundManageHome2(ShopsBankCard shopsBankCard);

    /**
     * 资金管理详情头部
     * @param shopsBankCard
     * @return
     */
    FundManageDetailVo fundManageDetail1(FundManageDetailVo shopsBankCard);

    /**
     * 资金管理详情list
     * @param shopsBankCard
     * @return
     */
    List<FundManageDetailVo.SettleInfo> fundManageDetail2(FundManageDetailVo shopsBankCard);

    /**
     * 检查用户银行卡信息
     * @param shopsBankCard
     * @return
     */
    ShopsBankCard checkShopsBankCard(ShopsBankCard shopsBankCard);

    /**
     * 出入库填充二维码
     * @param subOrderIds
     * @param imgUrlList
     * @return
     */
    int updShopQRCode(@Param("trackingDirection") String trackingDirection,@Param("subOrderId") String subOrderIds, @Param("imgUrl") String imgUrlList);

    /**
     * 获取订单信息
     * @param subOrderIds
     * @return
     */
    List<JsbOrdersItem> getSubOrderIdInfoList(@Param("list") List<String> subOrderIds);

    /**
     * 小站是否有旗舰店
     * @param uid
     * @return
     */
    String getHaveShopPlus(String uid);

    /**
     * 填充jsb_orders_shop_item中next_to_id，出库时，下一步去向
     * @param normalList
     * @return
     */
    int updOrderShopItem(@Param("list") List<JsbOrdersItem> normalList);

    /**
     * 查询工厂
     * @return
     */
    List<Shops> getFactory();

    /**
     * 已出库订单入司机表jsb_orders_driver_item中
     * @param ordersItemList
     * @return
     */
    int addOrderToDriverItem(@Param("list") List<JsbOrdersItem> ordersItemList);

    /**
     * 获取异常单列表
     * @param shopOrder
     * @return
     */
    List<ShopOrderVo> getShopsExceptionOrderList(ShopOrderVo shopOrder);

    /**
     * 获取司机填写异常信息
     * @param shopOrder
     * @return
     */
    JsbOrderException batchShopsExceptionOrderPageData(ShopOrderVo shopOrder);

    /**
     * 状态调整 exception_check_status 检查操作
     * @param shopOrder
     * @return
     */
    int updShopsExceptionOrderStatus(ShopOrderVo shopOrder);

    int updShopsExceptionOrderStatus1(ShopOrderVo shopOrder);

    int updShopsExceptionOrderStatus2(ShopOrderVo shopOrder);

    List<JsbOrdersShopItem> getOrderShopItem(@Param("list") List<String> subOrderIds);

    List<JsbOrdersShop> getShopsOrderInfoList(@Param("list") List<JsbOrdersShopItem> distinctItems);

    JsbOrders getOrderInfos(JsbOrdersShop jsbOrdersShop);

    JsbOrdersShopItem checkAllSuborderInOutShop1(JsbOrdersShopItem distinctItems);

    List<JsbOrdersFulfillmentItem> getOrdersDriverItem(@Param("list") List<String> ids,@Param("trackingDirection") String trackingDirection);

    /**
     * 小站出入库订单信息
     * @param shopOrder
     * @return
     */
    List<BatchOPShopsOrderVo.OrderOPRecords> getOrderOPRecordList(ShopOrderVo shopOrder);

    Shops getShopsInfo1(String uid);

    /**
     * 入小站子订单总数量
     * @param shopOrder
     * @return
     */
    int getAllSuborderInShopNum(ShopOrderVo shopOrder);

    /**
     * 当前状态在店铺里的子订单数量
     * @param shopOrderVo
     * @return
     */
    int getCurrentSuborderOnShopNum(ShopOrderVo shopOrderVo);

    List<JsbOrdersFulfillmentItem> getOrdersFulfillmentItem(@Param("list") List<String> subOrderIds);

    /**
     * 异常件
     * @param shopOrder
     * @return
     */
    JsbOrderException getOrderException(ShopOrderVo shopOrder);

    /**
     * 提现记录
     * @param withdrawal
     * @return
     */
    int addWithdrawalRecords(Withdrawals withdrawal);

    /**
     * 订单总实际支付金额、原价
     * @param subOrderIdList
     * @return
     */
    List<JsbOrdersItem> getProductAndOrderInfo(@Param("list")List<String> subOrderIdList,@Param("trackingDirection") String trackingDirection);

    int checkShopCommission(String orderId);
}
